<template>
  <view class="mainView">
    <text>柱状图</text>
    <eui-ucharts type="column"
                      :opts="{enableScroll: true,extra:{column:{type:'group'}},xAxis:{rotateLabel:true,rotateAngle:25,scrollShow: true,itemCount: 4},yAxis:{gridType:'dash'}}"
                      :chartData="chartData" style="width:98%;height:500rpx" />
    <text>折线图</text>
    <eui-ucharts type="line" :opts="{extra:{line:{type:'curve'}},xAxis:{rotateLabel:true,rotateAngle:25},yAxis:{gridType:'dash', unit: '万元', tofix: 2}}"
                      :eopts="{seriesTemplate:{smooth:true}}"
                      :chartData="chartsDataLine1" style="width:96%;height:500rpx"/>
  </view>
</template>

<script>
export default {
  name: "index",
  data() {
    return {
      chartData: {
        categories: ["2016", "2017", "2018", "2019", "2020", "2021"],
        series: [
          {
            name: "折扣额",
            data: [35, 36, 31, 33, 13, 34],
          },
          {
            name: "毛利额",
            data: [18, 27, 21, 24, 6, 28],
          },
          {
            name: "销售额",
            data: [18, 27, 21, 24, 6, 28],
          },
        ],
      },
      chartsDataLine1: {
        "categories": ["2016", "2017", "2018", "2019", "2020", "2021"],
        "series": [{
          "name": "本期",
          "data": [35, 8, 25, 37, 4, 20],
        }, {
          "name": "对期",
          "data": [70, 40, 65, 100, 44, 68],
        }, {
          "name": "环期",
          "data": [100, 80, 95, 150, 112, 132],
        }],
      },
      chartOption:  {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            // Use axis to trigger tooltip
            type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
          }
        },
        legend: {},
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: {
          type: 'value'
        },
        yAxis: {
          type: 'category',
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
        },
        series: [
          {
            name: 'Direct',
            type: 'bar',
            stack: 'total',
            label: {
              show: true
            },
            emphasis: {
              focus: 'series'
            },
            data: [320, 302, 301, 334, 390, 330, 320]
          },
          {
            name: 'Mail Ad',
            type: 'bar',
            stack: 'total',
            label: {
              show: true
            },
            emphasis: {
              focus: 'series'
            },
            data: [120, 132, 101, 134, 90, 230, 210]
          },
          {
            name: 'Affiliate Ad',
            type: 'bar',
            stack: 'total',
            label: {
              show: true
            },
            emphasis: {
              focus: 'series'
            },
            data: [220, 182, 191, 234, 290, 330, 310]
          },
          {
            name: 'Video Ad',
            type: 'bar',
            stack: 'total',
            label: {
              show: true
            },
            emphasis: {
              focus: 'series'
            },
            data: [150, 212, 201, 154, 190, 330, 410]
          },
          {
            name: 'Search Engine',
            type: 'bar',
            stack: 'total',
            label: {
              show: true
            },
            emphasis: {
              focus: 'series'
            },
            data: [820, 832, 901, 934, 1290, 1330, 1320]
          }
        ]
      },
      chartStyle: "height: 900rpx",
    }
  },
}
</script>

<style scoped>
.mainView {
  width: 100%;
  height: 100vh;
  background: #FFFFFF;
}
</style>
